//app.js
App({
  onLaunch: function() {
    //调用API从本地缓存中获取数据
    wx.setStorageSync('https','https://photo.tobeyoung.net/NewAlbums/index.php/Home/Interface/');
    wx.setStorageSync('banner','http://photo.tobeyoung.net/NewAlbums/Public/images/album/')
    wx.login({
    	success:function(res){
    		var code = res.code
			wx.getUserInfo({
				success:function(res2){
					var user_head = res2.userInfo.avatarUrl
					var user_namme = res2.userInfo.nickName
				
					wx.request({
						url:'https://photo.tobeyoung.net/NewAlbums/index.php/Home/Interface/Get_Openid',
						data:{
							code:code,
						},
						success:function(res3){
							var openid = res3.data.openid
							wx.request({
								url:'https://photo.tobeyoung.net/NewAlbums/index.php/Home/Interface/User_Login',
								data:{
									openid:openid,
									users_name:user_namme,
									users_head:user_head
								},
								success:function(res4){

								}
							})
						}
					})
				}
			})
 
    	}
    })
  },


  globalData: {
    userInfo: null

  }
})
